//
// Created by seeed on 25-8-14.
//
//
// Created by seeed on 25-8-14.
//

#include "recorder.h"

#include <esp32-hal-gpio.h>

// 构造函数，初始化录音播放引脚
Recorder::Recorder(uint8_t play_Pin) : playPin(play_Pin), recordPin(D2) {
    pinMode(playPin, OUTPUT);
    pinMode(recordPin, OUTPUT);
    stopPlay();
    stopRecord();
}

// 开始录制
void Recorder::startRecord() const {
    digitalWrite(recordPin, HIGH);
}

// 结束录制
void Recorder::stopRecord() const {
    digitalWrite(recordPin, LOW);
}

// 开始播放
void Recorder::startPlay() const {
    digitalWrite(playPin, HIGH);
}

// 结束播放
void Recorder::stopPlay() const {
    digitalWrite(playPin, LOW);
}